﻿/**
 * Created with JetBrains WebStorm.
 * User: basil
 * Date: 13-8-19
 * Time: 下午6:17
 * To change this template use File | Settings | File Templates.
 */
KISSY.add(function (_kissy_J) {
    var _event = _kissy_J.Event,
        _dom = _kissy_J.DOM,
        _anim = _kissy_J.Anim,
        _document = document,
        _window = window,
        _is_ie = _kissy_J.UA.ie && _kissy_J.UA.ie < 9,
        _is_ie6 = _is_ie && _kissy_J.UA.ie == 6,
        _str_J_ScrollTopBtn = "J_ScrollTopBtn",
        _str_ui_scrolltop_hidden = "ui-scrolltop-hidden";
    _validate_username_url = "/Account/IsNullByLoginName";
    _validate_email_url = "/Account/IsNullByEmail";

    function _validator_run_when_attention() {
        if (!_dom_div_class_KeyProp) {
            return;
        }
        var _dom_a_class_tb_act = _kissy_J.query("a." + _str_tb_act, _dom_div_class_KeyProp);
        if (_dom.hasClass(_dom_div_class_KeyProp, _tb_attention)) {
            if (_malldetail_sku_validator.run()) {
                _dom.addClass(_dom_a_class_tb_act, _tb_btn_inbox);
            } else {
                _dom.removeClass(_dom_a_class_tb_act, _tb_btn_inbox);
            }
        }
    }
    var _options = {

    };

    function Register() {
        if (!(this instanceof Register)) {
            return new Register();
        }
        this._init();
    }
    _kissy_J.augment(Register, {
        _init: function (A) {
            var id_username = _kissy_J.get("#id_username");
            var id_email = _kissy_J.get("#id_email");
            _event.on("#id_username","blur", function () {
                _kissy_J.io({
                    type: "post",
                    url: _validate_username_url + "?loginName=" + id_username.value,
                    dataType: "json",
                    success: function (result) {
                        alert(result);
                    }
                });

            });
        }
    });
    return {
        init: function () {
            new Register();
        }
    };
}, {
    requires: []
});